package com.abc.generator;
import java.awt.Color;

import javax.swing.JFrame;

import de.erichseifert.gral.data.DataTable;
import de.erichseifert.gral.plots.PiePlot;
import de.erichseifert.gral.plots.PiePlot.PieSliceRenderer;
import de.erichseifert.gral.plots.XYPlot;
import de.erichseifert.gral.plots.lines.DefaultLineRenderer2D;
import de.erichseifert.gral.plots.lines.LineRenderer;
import de.erichseifert.gral.ui.InteractivePanel;
import de.erichseifert.gral.util.Insets2D;
import com.abc.model.* ;
import com.abc.model.Project;
import com.abc.model.PersonYearEffort;
import com.abc.model.ProjectYear;
import com.abc.model.ReportRepository;
public class TestGral extends JFrame {
	
	public TestGral(double[]dane)
	{
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		setSize(800, 600);
		
		
		
		DataTable data = new DataTable(Double.class);
		for(int i=0;i<dane.length;i++)
		{
			data.add(dane[i]);
		}
		
		
		
		
		
		PiePlot plot = new PiePlot(data);
		getContentPane().add(new InteractivePanel(plot));
		
		plot.getTitle().setText(String.format("Rozklad godzin przeznaczony na projekty"));
		// Change relative size of pie
		plot.setRadius(0.9);
		// Display a legend
		plot.setLegendVisible(true);
		
		// Add some margin to the plot area
		plot.setInsets(new Insets2D.Double(20.0, 40.0, 40.0, 40.0));
		
		PieSliceRenderer pointRenderer =
				(PieSliceRenderer) plot.getPointRenderer(data);
		
		// Change relative size of inner region
				//pointRenderer.setInnerRadius(0.4);
				
		// Change the width of gaps between segments
		pointRenderer.setGap(0.2);
		plot.getLegend();
		
		
		
		
	}
	

	
	
	

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		
		
		
		double[] dane = {3,5,6,2,5,6};
		//double [] dane = tablica;

		
		
		//zamist dane używasz ReportRepository.getAllEffortsForEmployee("developerName")

		TestGral frame = new TestGral(dane);
		frame.setVisible(true);
		 
		
		
	 
	 //System.out.println(proj.getAllEffort());
		
		
		
		
		
	}

}
